package com.qqbot.impl.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.qqbot.core.message.MessageChain;
import com.qqbot.impl.service.LingDuApiService;
import com.qqbot.impl.service.XiaoBaiApiService;
import com.qqbot.impl.utils.Constants;
import com.qqbot.impl.utils.HttpClientUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * 小白API服务
 *
 * @author changwenpeng
 * @date 2022年5月14日
 */
@Service
public class XiaoBaiApiServiceImpl implements XiaoBaiApiService {

    @Override
    public MessageChain video(String keyword) throws Exception {
        String url = "http://xiaobai.klizi.cn/API/video/kysp.php?data=&lx=" + keyword;
        String resText = HttpClientUtils.get(url, 15000, 15000);
        return new MessageChain().video(resText);
    }

    @Override
    public MessageChain headChui(String keyword) throws Exception {
        String url = "http://xiaobai.klizi.cn/API/gif/hammer.php?qq="+keyword;
        return new MessageChain().image(url);
    }

    @Override
    public MessageChain headZhua(String keyword) throws Exception {
        String url = "http://xiaobai.klizi.cn/API/gif/tightly.php?qq="+keyword;
        return new MessageChain().image(url);
    }

    @Override
    public MessageChain headken(String keyword) throws Exception {
        String url = "http://xiaobai.klizi.cn/API/gif/bite.php?qq="+keyword;
        return new MessageChain().image(url);
    }

    @Override
    public MessageChain yuanFen(String keyword, String keyword1) throws Exception {
        String url = "http://xiaobai.klizi.cn/API/other/yf.php?name1="+keyword+"&name2="+keyword1;
        String resText = HttpClientUtils.get(url, 15000, 15000);
        return new MessageChain().text(resText);
    }

}
